home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: New Zealand Amiga Users Group
/
New Zealand Amiga Users Group Newsdisk v03 (1987-02)(NZAmigaUG).zip
/
New Zealand Amiga Users Group Newsdisk v03 (1987-02)(NZAmigaUG).adf
/
BASIC
/
Triangles
(
.txt
)
< prev
next >
Wrap
AmigaBASIC Source Code
|
1993-12-02
|
1KB
|
49 lines
REM try 20 segments and click a square to get the idea!
REM
ON BREAK GOSUB 5000
ON ERROR GOTO 5000
SCREEN 1,640,200,4,2
WINDOW 2,"Triangles",(0,0)-(600,180),7,1
1 col% = 2
5 DIM xx(500),yy(500)
10 INPUT"Divide segments by how many [0 to EXIT]";space
20 PRINT"Click your points. When done, click top left."
IF space=0 THEN 5000
40 GOSUB 1000
50 c%=0
60 xx(c%)=x%:yy(c%)=y%
65 CLS
70 PSET (x%,y%)
80 c%=c%+1
90 GOSUB 1000
100 IF (x%<10) AND (y%<10) THEN GOTO 200
110 xx(c%)=x%:yy(c%)=y%
120 LINE -( x%,y%)
125 FOR j%=0 TO 500:NEXT
130 IF c% < 499 GOTO 80
200 LINE -(xx(0),yy(0))
210 ' **********
220 FOR i% = 0 TO c%-1
230 xx(i%)=xx(i%) + ((xx(i%+1)-xx(i%))/space)
240 yy(i%)=yy(i%) + ((yy(i%+1)-yy(i%))/space)
245 xx(c%)=xx(0):yy(c%)=yy(0)
250 NEXT i%
260 xx(c%)=xx(0)
265 yy(c%)=yy(0)
270 PSET (xx(0),yy(0))
280 FOR i%=0 TO c%
290 LINE -(xx(i%),yy(i%))
300 NEXT i%:IF MOUSE(0)<0 THEN COLOR 1:CLS:GOTO 10
305 GOSUB 2000
310 GOTO 220
1000 b%= MOUSE(0):x%=MOUSE(1):y%=MOUSE(2)
1010 IF b% >= 0 THEN GOTO 1000
1020 RETURN
2000 col% = col% + 1
2010 col% = col% MOD 16
2020 COLOR col%,col%
2030 RETURN
5000 SCREEN CLOSE 1
5010 STOP